package com.example.demo;

import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author :蕉绿
 * @Date : 2023/2/11 11:54
 * @Version : V1.0
 * @Description :
 */

@RestController
public class TestController {

    @RequestMapping("/hi")
    public String sayHi(String name) {
//        if(name == null || name.equals("")) {
//            name = "张三";
//        }
        //判断是否有长度
        if(!StringUtils.hasLength(name)) {
            name = "李四";
        }
        return "你好: "  + name;
    }
}
